<template>
	<view class="content">
		
		
		
			<view class="row b-b" >
		
				<input type="text" class="input" placeholder="请输入纳税人名" placeholder-class="placeholder">
			</view>
			<view class="row b-b" >
					
				<input type="text" class="input" placeholder="请输入纳税人识别号" placeholder-class="placeholder">
			</view>
			<view class="row b-b" >
					
				<input type="text" class="input" placeholder="请输入开户银行" placeholder-class="placeholder">
			</view>
			<view class="row b-b" >
					
				<input type="text" class="input" placeholder="请输入电话" placeholder-class="placeholder">
			</view>
			<view class="row b-b" >
					
				<input type="text" class="input" placeholder="请输入地址" placeholder-class="placeholder">
			</view>
			<view class="row b-b" >
					
				<input type="text" class="input" placeholder="请输入备注信息" placeholder-class="placeholder">
			</view>
			<view class="row b-b" >
					
				<label class="radio input"><radio value="r1" color="#13C0A4" />设为默认增票信息</label>
			</view>
			
		<button class="add-btn" @click="confirm">保存</button>
	
	</view>
</template>

<script>
	export default {
		components:{
		
		},
		data() {
			return {
				addressData: {
					name: '',
					mobile: '',
					addressName: '',
					address: '',
					area: '',
					default: false
				},
				 array: ['电子发票', '增值税专用发票'],
				 index: 0,
				 checknum:'1'
			}
		},
		onLoad(option){
			// let title = '新增收货地址';
			// if(option.type==='edit'){
			// 	title = '编辑收货地址'
				
			// 	this.addressData = JSON.parse(option.data)
			// }
			// this.manageType = option.type;
			// uni.setNavigationBarTitle({
			// 	title
			// })
		},
		methods: {
			check(str){
				this.checknum = str
			},
			switchChange(e){
				this.addressData.default = e.detail;
			},
			bindPickerChange: function(e) {
				console.log('picsker发送选择改变，携带值为', e.target.value)
				this.index = e.target.value
			},
			tolist(){
				uni.navigateTo({
					url:`/pages/invoice/index`
				})
			},
			
			//提交
			confirm(){
				let data = this.addressData;
				if(!data.name){
					this.$api.msg('请填写收货人姓名');
					return;
				}
				if(!/(^1[3|4|5|7|8][0-9]{9}$)/.test(data.mobile)){
					this.$api.msg('请输入正确的手机号码');
					return;
				}
				if(!data.address){
					this.$api.msg('请在地图选择所在位置');
					return;
				}
				if(!data.area){
					this.$api.msg('请填写门牌号信息');
					return;
				}
				
				//this.$api.prePage()获取上一页实例，可直接调用上页所有数据和方法，在App.vue定义
				this.$api.prePage().refreshList(data, this.manageType);
				this.$api.msg(`地址${this.manageType=='edit' ? '修改': '添加'}成功`);
				setTimeout(()=>{
					uni.navigateBack()
				}, 800)
			},
		
			
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background: $page-color-base;
		padding-top: 16upx;
		padding: 20upx 58upx;
	}

	.row{
		display: flex;
		align-items: flex-end;
		position: relative;
		padding-bottom: 13upx;
		height: 89upx;
		radio{
			transform:scale(0.7)
		}
		
		// background: #fff;
		
		.tit{
			flex-shrink: 0;
			min-width: 120upx;
			font-size:23upx;
			font-family:Microsoft YaHei;
			font-weight:400;
			color:rgba(102,102,102,1);
		}
		
		.input{
			flex: 1;
			font-size:23upx;
			font-family:Microsoft YaHei;
			font-weight:400;
			color:rgba(153,153,153,1);
			text-align: left;
			
		}
		.picker{
			flex: 1;
			font-size:23upx;
			font-family:Microsoft YaHei;
			font-weight:400;
			color:rgba(153,153,153,1);
			text-align: left;
		}
		.uni-input{
			font-size:23upx;
			font-family:Microsoft YaHei;
			font-weight:400;
			color:rgba(153,153,153,1);
		}
		.text{
			font-size:21upx;
			font-family:Microsoft YaHei;
			font-weight:400;
			color:rgba(153,153,153,1);
			line-height:33upx;
		}
		
		.icon-xia{
			// flex: 1;
			// text-align: right;
			font-size:28upx;
			font-family:Microsoft YaHei;
			font-weight:400;
			color:rgba(153,153,153,1);
		}
		.icon-you{
			// flex: 1;
			// text-align: right;
			font-size:23upx;
			font-family:Microsoft YaHei;
			font-weight:400;
			color:rgba(153,153,153,1);
		}
	}
	.info{
		padding: 10upx 27upx;
		background: #fff;
		margin-top: 11upx;
		.default-row{
			.tit{
				color:#999!important;
				flex: none;
			}
			.input{
				font-size:23upx;
				font-family:Microsoft YaHei;
				font-weight:400;
				color:rgba(102,102,102,1)!important;
			}
		}
		.row{
			display: flex;
			align-items: center;
			position: relative;
			padding:0 0;
			height: 75upx;
			background: #fff;
			
			.tit{
				flex-shrink: 0;
				min-width: 120upx;
				font-size:23upx;
				font-family:Microsoft YaHei;
				font-weight:400;
				color:rgba(102,102,102,1);
			}
			.addr-btn{
			
				width:94upx;
				height:44upx;
				background:rgba(255,255,255,1);
				border:1upx solid rgba(210, 210, 210, 1);
				border-radius:22upx;
				font-size:23upx;
				font-family:Microsoft YaHei;
				font-weight:400;
				color:rgba(102,102,102,1);
				display: flex;
				justify-content: center;
				align-items: center;
				margin-right: 30upx;
				
			}
			.active{
				background:rgba(240,64,111,1);
				color: #fff;
			}
			.input{
				flex: 1;
				font-size:23upx;
				font-family:Microsoft YaHei;
				font-weight:400;
				color:#999;
				// color:rgba(102,102,102,1);
				text-align: left;
				margin-left: 31upx;
				
			}
		
			
			.text{
				font-size:21upx;
				font-family:Microsoft YaHei;
				font-weight:400;
				color:rgba(153,153,153,1);
				line-height:33upx;
			}
		
		}
		
	}
	.default-row{
		
		.tit{
			flex: 1;
		}
		switch{
			transform: translateX(16upx) scale(.9);
		}
	}
	.add-btn{
		margin: 50upx auto;
		z-index: 95;
		display: flex;
		align-items: center;
		justify-content: center;
		width:100%;
		height:73upx;
		background:#13C0A4;
		border-radius:36upx;
		font-size:23upx;
		font-family:Microsoft YaHei;
		font-weight:400;
		color:rgba(255,255,255,1);
	}
</style>
